import store from '@/store'

export function getToken() {
  return store.state.user.token || ''
}

export function setToken(token) {
  return store.dispatch('user/Login', token)
}

export function removeToken() {
  return store.dispatch('user/LogOut')
}

export function clearToken() {
  return store.dispatch('user/LogClear')
}

export function getUserInfo() {
  return store.state.user?.user || null
}

export function getRoles() {
  return store.state.user?.roles || []
}

export function getPermissions() {
  return store.state.user?.permissions || []
}
